home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.FlowLayout;
- import java.awt.Frame;
- import java.awt.Label;
- import java.awt.TextField;
- import java.awt.Window;
-
- public class OpenDialog extends Frame {
- OpenSesame opensesame;
- public static final String MAGICSPELL = "open sesame";
- TextField passwd;
-
- OpenDialog(OpenSesame var1) {
- super("open sesame");
- ((Container)this).setLayout(new FlowLayout());
- ((Container)this).add(new Label("Magic Spell?"));
- this.passwd = new TextField(20);
- this.passwd.setEchoCharacter('*');
- ((Container)this).add(this.passwd);
- ((Window)this).pack();
- this.opensesame = var1;
- }
-
- public boolean handleEvent(Event var1) {
- switch (var1.id) {
- case 1001:
- if (this.passwd == var1.target) {
- if (((String)var1.arg).equals("open sesame")) {
- this.opensesame.openDoor();
- ((Component)this).hide();
- return true;
- }
-
- this.passwd.setText("");
- return true;
- }
- default:
- return false;
- }
- }
- }
-